<div class="col-sm-3 col-md-2 sidebar">

{% if perms.user.is_supervisor %}
  <ul class="nav nav-sidebar">
    <li class="{{ view.user_list_class }}">
        <a href="{% url "user:list" %}">Manage User</a>
    </li>
    <li class="{{ view.user_create_class }}">
        <a href="{% url "user:create" %}">Create User</a>
    </li>
  </ul>
  <ul class="nav nav-sidebar">
    <li class="{{ view.course_calendar_class }}">
        <a href="{% url "course:admin_calendar" %}">Course Calendar</a>
    </li>
    <li class="{{ view.course_list_class }}">
        <a href="{% url "course:list" %}">Manage Course</a>
    </li>
    <li class="{{ view.course_create_class }}">
        <a href="{% url "course:add" %}">Create Course</a>
    </li>
  </ul>
{% endif %}

{% if perms.user.is_teacher %}
  {% for title, courses_with_same_title in view.sidebar_dic.items %}
  {% with bigForloop=forloop.counter %}
    {% with temp_course=courses_with_same_title|first %}
      <ul class="nav nav-sidebar">
        {% url "course:united_students" temp_course.slug as m_url %}
          {% if m_url == request.path %}
              <li class="active">
          {% else %}
              <li>
          {% endif %}
        <a href="{% url "course:united_students" temp_course.slug %}">{{ title }}</a>
        </li>
      </ul>
    {% endwith %}

    {% for course_obj in courses_with_same_title %}
      <span data-toggle="collapse" href="#collapseOne{{ bigForloop }}{{ forloop.counter }}">{{ course_obj.semester|add:course_obj.classroom }}</span>
      <div>
      <ul class="nav nav-sidebar collapse" id="collapseOne{{ bigForloop }}{{ forloop.counter }}">
<!--       <span>{{ course_obj.semester|add:course_obj.classroom }}</span>
      <ul class="nav nav-sidebar"> -->
          {% url "course:students" course_obj.id as m_url %}
          {% if request.path == m_url %}
            <li class="active">
          {% else %}
            <li>
          {% endif %}
              <a href="{% url "course:students" course_obj.id %}">Manage Students</a>
          </li>

        {% with temp=0 %}
          {% url "course:calendar" course_obj.id as m_url %}
          {% if request.path == m_url %}
            <li class="active">
          {% else %}
            <li>
          {% endif %}
            <a href="{% url "course:calendar" course_obj.id %}">course calendar</a>
          </li>
        {% endwith %}

      </ul>
      </div>
    {% endfor %}
    {% endwith %} <!-- with bigForloop=forloop.counter  -->
  {% endfor %}
{% endif %}

<ul class="nav nav-sidebar">
  <h5>Tasks</h5>
  <li class="">
      <a href="{% url "task:view_list_as_assignee" %}">being assigned</a>
  </li>
  <li class="">
      <a href="{% url "task:view_list_as_assignor" %}">assigned</a>
  </li>
</ul>

</div> <!--  /sidebar -->